import chardet
# 爬虫

import requests

url = "https://www.gxnzd.edu.cn/xxgk/xxgk.htm"

headers = {
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
    "Accept-Encoding": "gzip, deflate, br, zstd",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Connection": "keep-alive",
    # "Host": "www.baidu.com",
    "Referer": "https://www.gxnzd.edu.cn/",
    "Cookie": "JSESSIONID=4F53315F8473CEE701D1AAE001F1B697",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}

res = requests.get(url, timeout=(10, 30), verify=False, headers=headers)

raw_content = res.content
detected_encoding = chardet.detect(raw_content)['encoding']
content = raw_content.decode(detected_encoding)
print(content)
